﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>权限配置表</title>
    <!--<link href="../../script/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../script/css/bootstrap-table.css" rel="stylesheet" />
    <script src="../../script/js/jquery-1.12.3.js"></script>
    <script src="../../script/js/bootstrap.min.js"></script>
    <script src="../../script/js/bootstrap-table.js"></script>
    <script src="../../script/js/bootstrap-table-zh-CN.js"></script>
    <script src="../../script/js/cus-grid.js"></script>-->
</head>
<body>
    <div style="width:100%">
        <table name="sys_menuRole"></table>
    </div>
    <script name="loadPage">
        var sys_menuRole_init;

        var sys_menuRole = {
        data: {
                data:[]
        },
        detailLink:[],
            rowbtns:[],
        toolbtns:[],
        cols:[],
        new: function () {
            sys_menuRole_init.editLoad('../sys_menuRole/sys_menuRole_edit.html');
        },
        edit: function () {
            sys_menuRole_init.editLoad('../sys_menuRole/sys_menuRole_edit.html');
        },
        del: function () {
            $.post('/api/sys_menuRole/del', { id: sys_menuRole_init.getId_edit }, function () {
                window.location.reload();
        });
        },
        mdel: function () {
            $.post('/api/sys_menuRole/mdel', { objs: sys_menuRole_init.getSelects() }, function () {
                window.location.reload();
        });
        },
        check: function () {

        },
        mcheck: function () {

        }
        };

        $(function () {
            sys_menuRole.cols = [
//{field: 'menuid',title: '菜单'},
{field: 'roleid',title: '角色',formatter: function (val, row, idx) {
                                            var str = '';
                                            for (var i = 0; i < sys_menuRole.data['roleid'].length; i++) {
                                                var p = sys_menuRole.data['roleid'][i];
                                                if (p.id == val) {
                                                    str = str == '' ? p.text : str + ',' + p.text;
                                                }
                                            }
                                            return str;
                                        }}
,{field: 'btns',title: '按钮'}
                ];

            sys_menuRole.rowbtns.push({
                text: '编辑',
                fn: 'sys_menuRole.edit'
            });
            sys_menuRole.rowbtns.push({
                text: '删除',
                fn: 'sys_menuRole.del'
            });
            sys_menuRole.rowbtns.push({
                jstr: '<button class="btn btn-danger" onclick="sys_menuRole.check();">审核</button>'
            });

            sys_menuRole.toolbtns.push({
                text: '新增',
                fn: 'sys_menuRole.new'
            });
            sys_menuRole.toolbtns.push({
                text: '删除',
                fn: 'sys_menuRole.mdel'
            });
            sys_menuRole.toolbtns.push({
                jstr: '<button class="btn btn-danger" onclick="sys_menuRole.mcheck();">审核</button>'
            });

            //sys_menuRole.detailLink.push({
            //    tablename: 'table2',
            //    parentid: 'name',
            //    caption: 'tname',
            //    isActive: true
            //});

            sys_menuRole_init = sys_menuRole_init == undefined ? cusGrid() : function () {
                return sys_menuRole_init.reCreate();
            }();
            $.get('/api/sys_menuRole/get',
{ menuid: sys_menu_init.getId_detail_grid() } ,
                    function (data) {
            sys_menuRole.data = data;
        sys_menuRole_init.init({
            data: sys_menuRole.data,
                detailLink: sys_menuRole.detailLink,
                    rowbtns: sys_menuRole.rowbtns,
                        toolbtns: sys_menuRole.toolbtns,
                            cols: sys_menuRole.cols,
                                isSelect:true,
                                tableName: 'sys_menuRole'
                            });
        sys_menuRole_init.initTable();
        });
        })
    </script>



</body>
</html>
